<%= hidden_field_tag 'tag_button', 'tag' %>
<%= hidden_field_tag 'year_of_survey', 'survey_year' %>
<%= hidden_field_tag 'variable_name', 'variable_name' %>
<%= hidden_field_tag 'variable_identifier', 'variable_identifier' %>
<%= hidden_field_tag 'watch_variable', 'watch_variable' %>
<% form_remote_tag :url => { :action => "add_to_cart"} do -%>
<%= hidden_field_tag 'submit', 'add' %>
  <% if @selected_surveys!=nil %>
    <% @selected_surveys.each do |val| %>
      <%= hidden_field_tag "survey_list[]", val %>
    <% end %>
  <% end %>
  <div style="background-color:#ACCBE0;padding-top:5px;padding-bottom:5px;padding-left:5px;width:900px;">
    <div><%= submit_tag'Add selected variables to cart', :name=>"_submit",:src=>'/images/famfamfam_silk/cart_add.png', :onclick => "Form.getInputs(this.form, null,'submit')[0].value = 'add';" -%></div>
    <div><%= text_field_tag :link_variables_text, @link_reason %><%= submit_tag 'Link selected variables',:name=>"_submit", :id => "link_variables_button",:onclick => "Form.getInputs(this.form, null,'submit')[0].value = 'link';" -%></div>
    <br/>
    <div>Select:
      <%= link_to_function 'All', "$$('input.variable_checkbox').each(function(checkbox) { checkbox.checked = true; });" %>
      ,&nbsp
      <%= link_to_function 'None', "$$('input.variable_checkbox').each(function(checkbox) { checkbox.checked = false; });" %>
      ,&nbsp
      <%= link_to_function 'Invert selection', "$$('input.variable_checkbox').each(function(checkbox) { if (checkbox.checked == true) {checkbox.checked = false;} else {checkbox.checked = true; } });" %>

    </div>
  </div>
  <br/>
  <br/>
  <div id="table_header" class="faux_table_header_container">
    <%= render :partial => "table_header" -%>
  </div>
  <div id="table_container" class="faux_table_container">
     <%= render :partial => "table" -%>
    <%# @sorted_variables.each do |item| %>
      <%#= render :partial => "surveys/variables_table_row",:locals=>{:item => item} %>

    <%# end %>
  <% end -%>
</div>